
IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FKaamaaid]') AND parent_object_id = OBJECT_ID(N'[dbo].[actionablealertmessage]'))
ALTER TABLE [dbo].[actionablealertmessage] DROP CONSTRAINT [FKaamaaid]
GO

/****** Object:  Table [dbo].[actionablealertsmessage]    Script Date: 02/24/2012 11:51:28 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[actionablealertmessage]') AND type in (N'U'))
DROP TABLE [dbo].[actionablealertmessage]
GO


IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FKaamaaid]') AND parent_object_id = OBJECT_ID(N'[dbo].[actionablealertsmessage]'))
ALTER TABLE [dbo].[actionablealertsmessage] DROP CONSTRAINT [FKaamaaid]
GO

/****** Object:  Table [dbo].[actionablealertsmessage]    Script Date: 02/24/2012 11:51:28 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[actionablealertsmessage]') AND type in (N'U'))
DROP TABLE [dbo].[actionablealertsmessage]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FKcaamaaid]') AND parent_object_id = OBJECT_ID(N'[dbo].[Cacheactionablealertsmessage]'))
ALTER TABLE [dbo].[Cacheactionablealertsmessage] DROP CONSTRAINT [FKcaamaaid]
GO


/****** Object:  Table [dbo].[Cacheactionablealertsmessage]    Script Date: 02/25/2012 13:43:57 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Cacheactionablealertsmessage]') AND type in (N'U'))
DROP TABLE [dbo].[Cacheactionablealertsmessage]
GO

/****** Object:  Table [dbo].[actionablealerts]    Script Date: 02/22/2012 13:26:03 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[actionablealerts]') AND type in (N'U'))
DROP TABLE [dbo].[actionablealerts]
GO

/****** Object:  Table [dbo].[actionablealerts]    Script Date: 02/22/2012 13:26:03 ******/

CREATE TABLE [dbo].[actionablealerts](
	[id] [int] NOT NULL primary key,
	[module] [varchar](255) NULL,
	[type] [varchar](255) NULL,
	[createdby] [int] NULL,
	[createdate] [datetime] NULL,
	[lastupdated] [datetime] NULL,
	[lastupdatedby] [int] NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[actionablealerts]  ADD CONSTRAINT [FKAAlastupdated] FOREIGN KEY([lastupdatedby])
REFERENCES [dbo].[userinfo] ([id])
GO

ALTER TABLE [dbo].[actionablealerts]   ADD  CONSTRAINT [FKaacreteedby] FOREIGN KEY([createdby])
REFERENCES [dbo].[userinfo] ([id])
GO

insert into  actionablealerts(id,module,type) values(1,'Partner Monitoring' 	,'AASS Overdue')
insert into  actionablealerts(id,module,type) values(2,'Partner Monitoring',  'Final Audit Past Due')
insert into  actionablealerts(id,module,type) values(3,'Partner Grant' ,		'Financial Report Past Due')
insert into  actionablealerts(id,module,type) values(4,'Partner Monitoring', 	'Interim Audit Past Due')
insert into  actionablealerts(id,module,type) values(5,'Partner Grant',		'Narrative Report Past Due')
insert into  actionablealerts(id,module,type) values(6,'Partner Monitoring',	'Past Due IMP')
insert into  actionablealerts(id,module,type) values(7,'Payment Request',     'Overdue Payment Request')
insert into  actionablealerts(id,module,type) values(8,'Payment Request',		'Rejected Payment Request')
insert into  actionablealerts(id,module,type) values(9,'Partner Grant',		'No Partner Grant Payment Request Activity')
insert into  actionablealerts(id,module,type) values(10,'Project Summary', 	'No Project Payment Request Activity')
insert into  actionablealerts(id,module,type) values(11,'Partner Grant',		'Partner Grant Signature Not Received')
insert into  actionablealerts(id,module,type) values(12,'Donor Awards View','Donor Award Ending');




/****** Object:  Table [dbo].[actionablealertsmessage]    Script Date: 02/22/2012 13:22:34 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[actionablealertsmessage](
	[id] [int] NOT NULL primary key identity,
	[date] [datetime] NULL,
	[message] [varchar](255) NULL,
	[url] [varchar](255) NULL,
	[actionablealertsid] [int] NULL
	
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[actionablealertsmessage]   ADD  CONSTRAINT [FKaamaaid] FOREIGN KEY([actionablealertsid])
REFERENCES [dbo].[actionablealerts] ([id])
GO




/****** Object:  Table [dbo].[Cacheactionablealertsmessage]    Script Date: 02/25/2012 13:43:57 ******/

CREATE TABLE [dbo].[Cacheactionablealertsmessage](
	[id] [int] NOT NULL identity,
	[date] [datetime] NULL,
	[message] [varchar](255) NULL,
	[url] [varchar](255) NULL,
	[actionablealertsid] [int] NULL,
PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


ALTER TABLE [dbo].[Cacheactionablealertsmessage]  WITH CHECK ADD  CONSTRAINT [FKcaamaaid] FOREIGN KEY([actionablealertsid])
REFERENCES [dbo].[actionablealerts] ([id])
GO

ALTER TABLE [dbo].[Cacheactionablealertsmessage] CHECK CONSTRAINT [FKcaamaaid]
GO

